package com.company.algo.graph;

import java.util.Arrays;
import java.util.Scanner;

public class Floyed {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();            //顶点数量 序号1~n
        int[][] vertex = new int[101][3];
        double[][] graph = new double[101][101];
        //初始化graph数组为最大值
        for(double[] a:graph)
            Arrays.fill(a,Double.MAX_VALUE);

        for(int i=1;i<=n;i++){
            vertex[i][1] = sc.nextInt(); //x
            vertex[i][2] = sc.nextInt(); //y
        }
        int m = sc.nextInt();
        for(int i = 0; i < m; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            graph[x][y] = Math.sqrt(Math.pow(vertex[x][1]-vertex[y][1], 2)+Math.pow(vertex[x][2]-vertex[y][2], 2));
            graph[y][x] = graph[x][y];  //无向图
        }
        int s = sc.nextInt();           //start
        int e = sc.nextInt();           //end
        /* floyed 最短路径算法*/
        for(int k = 1; k <= n; k++){
            for (int i = 1; i <= n ; i++) {
                for (int j = 1; j <= n; j++) {
                    if ((i!=j) && (i!=k) && (j!=k) && (graph[i][k]+graph[k][j]<graph[i][j]))
                        graph[i][j] = graph[i][k] + graph[k][j];
                }
            }
        }
        System.out.println(graph[s][e]);
    }
}
